import copy
class MobilePhone:
    def __init__(self,cpu,screen):
        self.cpu = cpu
        self.screen = screen

class CPU:
    def calculate(self):
        print("算你个12345")
        print("cpu对象：",self)

class Screen:
    def show(self):
        print("显示一个好看的画面")
        print("screen对象：",self)

m1 = CPU()
m2 = m1
print(id(m1))
print(id(m2))

#测试浅拷贝
s1 = Screen()
m3 = MobilePhone(m1,s1)
m4 = copy.copy(m3)

print(m3,m3.cpu,m3.screen)
print(m4,m4.cpu,m4.screen)

#测试深拷贝
print("测试深拷贝")
m5 = copy.deepcopy(m3)
print(m3,m3.cpu,m3.screen)
print(m5,m5.cpu,m5.screen)